package dataformat

// date-time: checks if input is formatted per RFC3339 5.6 (YYYY-MM-DDTHH:MM:SSZ-0700) or full date or full time
// date: checks if input is a correctly formatted date (YYYY-MM-DD)
// time: checks if input correctly formatted time (HH:MM:SS or HH:MM:SSZ-07:00)

import (
	"time"
)

func IsDateTime(datetimeStr string) bool {
	_, err := time.Parse(time.RFC3339, datetimeStr)
	_, errNoZ := time.Parse("2006-01-02T15:04:05", datetimeStr)
	return err == nil || errNoZ == nil
}

func IsDate(dateStr string) bool {
	_, err := time.Parse("2006-01-02", dateStr)
	return err == nil
}

func IsTime(timeStr string) bool {
	_, err := time.Parse("15:04:05Z07:00", timeStr)
	_, errNoZ := time.Parse("15:04:05", timeStr)
	return err == nil || errNoZ == nil
}
